package com.baijiarui.myself;

import com.fc.test.mapper.auto.ForeJobMapper;
import com.fc.test.mapper.auto.ForeNewsMapper;
import com.fc.test.mapper.auto.ForeRecruitMapper;
import com.fc.test.model.auto.ForeNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class contentAdminController {
    @Autowired
    public ForeNewsMapper foreNewsMapper;
    @Autowired
    public ForeJobMapper foreJobMapper;
    @Autowired
    public ForeRecruitMapper foreRecruitMapper;


    //新闻
    @RequestMapping("/contentAdmin/newsList")
    public Object newsList(){
        return foreNewsMapper.selectByExample(null);
    }

    @RequestMapping("/contentAdmin/addNews")
    public Object addNews(ForeNews foreNews){
        foreNews.setId(UUID.randomUUID().toString());
        return foreNewsMapper.insertSelective(foreNews);
    }

    @RequestMapping("/contentAdmin/deleteNewsById")
    public Object deleteNewsById(String id){
        return foreNewsMapper.deleteByPrimaryKey(id);
    }
    //求职
    @RequestMapping("/contentAdmin/jobList")
    public Object jobList(){
        return foreJobMapper.selectByExample(null);
    }
    @RequestMapping("/contentAdmin/deleteJob")
    public Object deleteJob(String id){
        return foreJobMapper.deleteByPrimaryKey(id);
    }
    //招聘
    @RequestMapping("/contentAdmin/recruitList")
    public Object recruitList(){
        return foreRecruitMapper.selectByExample(null);
    }
    @RequestMapping("/contentAdmin/deleteRecruit")
    public Object deleteRecruit(String id){
        return foreRecruitMapper.deleteByPrimaryKey(id);
    }



}
